
*********************************************************************************************************
**********  Table 5： The Impact of Elite Connections on National Offices: DDD Estimates
*********************************************************************************************************

use Data\NationalCntyYr.dta,clear


********************************************************************************
********** gen interactions

keep if year>=1820

gen nhXZenghu_all_invdist=nonhunan*Zenghu_all_invdist
gen hXZenghu_all_invdist=hunan*Zenghu_all_invdist

gen nhXZeng_all0_invdist=nonhunan*Zeng_all0_invdist
gen hXZeng_all0_invdist=hunan*Zeng_all0_invdist



foreach x of varlist hunan  Zenghu_all_invdist   Zeng_all0_invdist Zeng_all0_invdist_pc  invdist0_L1 invdist0_F1    Zeng_exam0_invdist  Zeng_Extraexam_invdist   Zeng_BMF_invdist    Zeng_juren0_invdist  nhXZenghu_all_invdist nhXZeng_all0_invdist  hXZenghu_all_invdist hXZeng_all0_invdist{
gen `x'Xperiod=`x'*period

}



foreach x of varlist  lnurbanpop prefcap lnjinshi lncntyquota0 lncntypop lncntyarea  mainriv dist2canal lnrice lnwheat dist_nanjing Taiping_route1 {
gen `x'Xperiod=`x'*period

}


foreach x of varlist  lnurbanpop prefcap lnjinshi lncntyquota0 lncntypop lncntyarea  mainriv dist2canal lnrice lnwheat dist_nanjing  Taiping_route1 {
gen h`x'Xperiod=hunan*`x'*period
}



********************************************************************************


***************
reghdfe alloff      Zeng_all0_invdistXperiod   if hunan==1, absorb(year samcntyid) cluster(prefid )
outreg2 using Results\Table_5.doc, keep( hXZeng_all0_invdistXperiod    Zeng_all0_invdistXperiod  hunanXperiod)  se  bdec(3) rdec(3) nocons replace 


reghdfe alloff    lnurbanpopXperiod-Taiping_route1Xperiod     Zeng_all0_invdistXperiod if hunan==1, absorb(year samcntyid) cluster(prefid  )
outreg2 using Results\Table_5.doc, keep( hXZeng_all0_invdistXperiod    Zeng_all0_invdistXperiod  hunanXperiod)  se  bdec(3) rdec(3) nocons append

  
***************
reghdfe alloff      Zeng_all0_invdistXperiod   if hunan==0, absorb(year samcntyid) cluster(prefid  )
outreg2 using Results\Table_5.doc, keep( hXZeng_all0_invdistXperiod    Zeng_all0_invdistXperiod  hunanXperiod)  se  bdec(3) rdec(3) nocons append

reghdfe alloff    lnurbanpopXperiod-Taiping_route1Xperiod     Zeng_all0_invdistXperiod if hunan==0, absorb(year samcntyid) cluster(prefid  )
outreg2 using Results\Table_5.doc, keep( hXZeng_all0_invdistXperiod    Zeng_all0_invdistXperiod  hunanXperiod)  se  bdec(3) rdec(3) nocons append

***************
reghdfe alloff     hXZeng_all0_invdistXperiod    Zeng_all0_invdistXperiod hunanXperiod, absorb(year samcntyid ) cluster(prefid  )
outreg2 using Results\Table_5.doc, keep( hXZeng_all0_invdistXperiod    Zeng_all0_invdistXperiod  hunanXperiod)  se  bdec(3) rdec(3) nocons append

reghdfe alloff    lnurbanpopXperiod-Taiping_route1Xperiod  hXZeng_all0_invdistXperiod    Zeng_all0_invdistXperiod hunanXperiod, absorb(year samcntyid ) cluster(prefid  )
outreg2 using Results\Table_5.doc, keep( hXZeng_all0_invdistXperiod    Zeng_all0_invdistXperiod  hunanXperiod)  se  bdec(3) rdec(3) nocons append  



 
 
 
      

